package algorithms;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

/**
 * @功能
 * @创建时间 2020/8/26
 */
public class Solution {

        public void  letterCombinations(String digits) {

            int w = 2;
            String[] s = getl(w);
            char[] a = digits.toCharArray();
            w = Integer.valueOf(a[0]);
            String[] s1 = getl(w);
            w = Integer.valueOf(a[1]);
            String[] s2 = getl(w);
            List<String> solt = new ArrayList<>();
            for (int i = 0; i < s1.length; i++) {
                for (int i1 = 0; i1 < s2.length; i1++) {
                    System.out.println(s1[i] + s2[i1]);
                }
            }
        }

        String[] getl(int w){
            String[] s2={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
            String[] s;
            if(w<9)
                 s= new String[]{s2[(w - 2) * 3], s2[(w - 2) * 3 + 1], s2[(w - 2) * 3 + 2]};
            else
               s= new String[]{s2[(w - 2) * 3], s2[(w - 2) * 3 + 1], s2[(w - 2) * 3 + 2], s2[(w - 2) * 3 + 3]};
            return s;
        }
    }

class client{
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, NoSuchMethodException {
        Solution solution=new Solution();
        Constructor<? extends Solution> constructor = solution.getClass().getConstructor();
        Supplier<Solution> solutionSupplier = ()-> {
            try {
                return solution.getClass().newInstance();
            } catch (InstantiationException e) {
                throw new RuntimeException(e);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        };
        solution.letterCombinations("23");
    }
}